
package com.hyst.seviceImpl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hyst.domain.Level;
import com.hyst.repository.LevelMapper;
import com.hyst.service.LevelService;
import com.hyst.utils.UuidTool;

/**
 * @Description:
 * @Date：2018年08月26日 
 * @author： dy 
 * @version ：1.0 1.[2018年08月26日]
 */
@Service
public class LevelServiceImpl implements LevelService {

	@Autowired
	private LevelMapper mapper;

	@Override
	public Page<Level> list(final Level level) {
		final Page<Level> page = PageHelper.startPage(level.getPageNum(), level.getPageSize());
		mapper.select(level);
		return page;
	}

	@Override
	public Level insert(final Level level) {
		level.setUniqueid(UuidTool.randomUUID());
		mapper.insertSelective(level);
		return level;
	}

	@Override
	public Level getByPriKey(final String uniqueid) {
		final Level level = mapper.selectByPrimaryKey(uniqueid);
		return level;
	}

	@Override
	public Level updateSelective(final Level level) {
		mapper.updateByPrimaryKeySelective(level);
		return level;
	}

	@Override
	public Level update(final Level level) {
		mapper.updateByPrimaryKey(level);
		return level;
	}

	@Override
	public Level delete(final String uniqueid) {

		return null;
	}

	@Override
	public List<Map> getSelect2Data(String uniqueid) {
		return mapper.getSelect2Data(uniqueid);
	}

}
